static gint count_expand_groups (GtkCellAreaBox *box);
static void context_weak_notify (GtkCellAreaBox *box,
GtkCellAreaBoxContext *dead_context);
-static void flush_contexts (GtkCellAreaBox *box);
+static void reset_contexts (GtkCellAreaBox *box);
static void init_context_groups (GtkCellAreaBox *box);
static void init_context_group (GtkCellAreaBox *box,
GtkCellAreaBoxContext *context);
expand_groups[i] = (group->expand_cells > 0);
}
- /* This call implies flushing the request info */
+ /* This call implies reseting the request info */
gtk_cell_area_box_init_groups (context, priv->groups->len, expand_groups);
g_free (expand_groups);
}
}
static void
-flush_contexts (GtkCellAreaBox *box)
+reset_contexts (GtkCellAreaBox *box)
{
GtkCellAreaBoxPrivate *priv = box->priv;
GSList *l;
/* When the box layout changes, contexts need to
- * be flushed and sizes for the box get requested again
+ * be reset and sizes for the box get requested again
*/
for (l = priv->contexts; l; l = l->next)
{
GtkCellAreaContext *context = l->data;
- gtk_cell_area_context_flush (context);
+ gtk_cell_area_context_reset (context);
}
}
box->priv->orientation = g_value_get_enum (value);
/* Notify that size needs to be requested again */
- flush_contexts (box);
+ reset_contexts (box);
break;
case PROP_SPACING:
gtk_cell_area_box_set_spacing (box, g_value_get_int (value));
g_object_notify (G_OBJECT (box), "spacing");
/* Notify that size needs to be requested again */
- flush_contexts (box);
+ reset_contexts (box);
}
}
#include "gtkorientable.h"
/* GObjectClass */
-static void gtk_cell_area_box_context_finalize (GObject *object);
+static void gtk_cell_area_box_context_finalize (GObject *object);
/* GtkCellAreaContextClass */
-static void gtk_cell_area_box_context_flush_preferred_width (GtkCellAreaContext *context);
-static void gtk_cell_area_box_context_flush_preferred_height (GtkCellAreaContext *context);
-static void gtk_cell_area_box_context_flush_allocation (GtkCellAreaContext *context);
-static void gtk_cell_area_box_context_sum_preferred_width (GtkCellAreaContext *context);
-static void gtk_cell_area_box_context_sum_preferred_height (GtkCellAreaContext *context);
-static void gtk_cell_area_box_context_allocate (GtkCellAreaContext *context,
- gint width,
- gint height);
-
-static void free_cache_array (GArray *array);
-static GArray *group_array_new (GtkCellAreaBoxContext *context);
-static GArray *get_array (GtkCellAreaBoxContext *context,
- GtkOrientation orientation,
- gint for_size);
-static gboolean group_expands (GtkCellAreaBoxContext *context,
- gint group_idx);
-static gint count_expand_groups (GtkCellAreaBoxContext *context);
+static void gtk_cell_area_box_context_reset (GtkCellAreaContext *context);
+static void gtk_cell_area_box_context_sum_preferred_width (GtkCellAreaContext *context);
+static void gtk_cell_area_box_context_sum_preferred_height (GtkCellAreaContext *context);
+static void gtk_cell_area_box_context_allocate (GtkCellAreaContext *context,
+ gint width,
+ gint height);
+
+/* Internal functions */
+static void free_cache_array (GArray *array);
+static GArray *group_array_new (GtkCellAreaBoxContext *context);
+static GArray *get_array (GtkCellAreaBoxContext *context,
+ GtkOrientation orientation,
+ gint for_size);
+static gboolean group_expands (GtkCellAreaBoxContext *context,
+ gint group_idx);
+static gint count_expand_groups (GtkCellAreaBoxContext *context);
/* CachedSize management */
/* GObjectClass */
object_class->finalize = gtk_cell_area_box_context_finalize;
- context_class->flush_preferred_width = gtk_cell_area_box_context_flush_preferred_width;
- context_class->flush_preferred_height = gtk_cell_area_box_context_flush_preferred_height;
- context_class->flush_allocation = gtk_cell_area_box_context_flush_allocation;
- context_class->sum_preferred_width = gtk_cell_area_box_context_sum_preferred_width;
- context_class->sum_preferred_height = gtk_cell_area_box_context_sum_preferred_height;
+ context_class->reset = gtk_cell_area_box_context_reset;
+ context_class->sum_preferred_width = gtk_cell_area_box_context_sum_preferred_width;
+ context_class->sum_preferred_height = gtk_cell_area_box_context_sum_preferred_height;
context_class->allocate = gtk_cell_area_box_context_allocate;
* GtkCellAreaContextClass *
*************************************************************/
static void
-gtk_cell_area_box_context_flush_preferred_width (GtkCellAreaContext *context)
+gtk_cell_area_box_context_reset (GtkCellAreaContext *context)
{
GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (context);
GtkCellAreaBoxContextPrivate *priv = box_context->priv;
+ CachedSize *size;
gint i;
for (i = 0; i < priv->base_widths->len; i++)
{
- CachedSize *size = &g_array_index (priv->base_widths, CachedSize, i);
+ size = &g_array_index (priv->base_widths, CachedSize, i);
size->min_size = 0;
size->nat_size = 0;
- }
-
- /* Flush context widths as well */
- g_hash_table_remove_all (priv->widths);
-
- GTK_CELL_AREA_CONTEXT_CLASS
- (gtk_cell_area_box_context_parent_class)->flush_preferred_width (context);
-}
-
-static void
-gtk_cell_area_box_context_flush_preferred_height (GtkCellAreaContext *context)
-{
- GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (context);
- GtkCellAreaBoxContextPrivate *priv = box_context->priv;
- gint i;
- for (i = 0; i < priv->base_heights->len; i++)
- {
- CachedSize *size = &g_array_index (priv->base_heights, CachedSize, i);
+ size = &g_array_index (priv->base_heights, CachedSize, i);
size->min_size = 0;
size->nat_size = 0;
}
- /* Flush context heights as well */
+ /* Reset context sizes as well */
+ g_hash_table_remove_all (priv->widths);
g_hash_table_remove_all (priv->heights);
- GTK_CELL_AREA_CONTEXT_CLASS
- (gtk_cell_area_box_context_parent_class)->flush_preferred_height (context);
-}
-
-static void
-gtk_cell_area_box_context_flush_allocation (GtkCellAreaContext *context)
-{
- GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (context);
- GtkCellAreaBoxContextPrivate *priv = box_context->priv;
-
+ /* Clear the allocation */
g_free (priv->orientation_allocs);
priv->orientation_allocs = NULL;
priv->n_orientation_allocs = 0;
+
+ GTK_CELL_AREA_CONTEXT_CLASS
+ (gtk_cell_area_box_context_parent_class)->reset (context);
}
static void
g_return_if_fail (GTK_IS_CELL_AREA_BOX_CONTEXT (box_context));
g_return_if_fail (n_groups == 0 || expand_groups != NULL);
- /* When the group dimensions change, all info must be flushed
+ /* When the group dimensions change, all info must be reset
* Note this already clears the min/nat values on the CachedSizes
*/
- gtk_cell_area_context_flush (GTK_CELL_AREA_CONTEXT (box_context));
+ gtk_cell_area_context_reset (GTK_CELL_AREA_CONTEXT (box_context));
priv = box_context->priv;
g_array_set_size (priv->base_widths, n_groups);
#include "gtkprivate.h"
/* GObjectClass */
-static void gtk_cell_area_context_dispose (GObject *object);
-static void gtk_cell_area_context_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void gtk_cell_area_context_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
+static void gtk_cell_area_context_dispose (GObject *object);
+static void gtk_cell_area_context_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gtk_cell_area_context_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
/* GtkCellAreaContextClass */
-static void gtk_cell_area_context_real_flush_preferred_width (GtkCellAreaContext *context);
-static void gtk_cell_area_context_real_flush_preferred_height (GtkCellAreaContext *context);
-static void gtk_cell_area_context_real_flush_allocation (GtkCellAreaContext *context);
-static void gtk_cell_area_context_real_allocate (GtkCellAreaContext *context,
- gint width,
- gint height);
+static void gtk_cell_area_context_real_reset (GtkCellAreaContext *context);
+static void gtk_cell_area_context_real_allocate (GtkCellAreaContext *context,
+ gint width,
+ gint height);
struct _GtkCellAreaContextPrivate
{
object_class->set_property = gtk_cell_area_context_set_property;
/* GtkCellAreaContextClass */
- class->flush_preferred_width = gtk_cell_area_context_real_flush_preferred_width;
- class->flush_preferred_height = gtk_cell_area_context_real_flush_preferred_height;
- class->flush_allocation = gtk_cell_area_context_real_flush_allocation;
+ class->reset = gtk_cell_area_context_real_reset;
class->sum_preferred_width = NULL;
class->sum_preferred_height = NULL;
class->allocate = gtk_cell_area_context_real_allocate;
* GtkCellAreaContextClass *
*************************************************************/
static void
-gtk_cell_area_context_real_flush_preferred_width (GtkCellAreaContext *context)
+gtk_cell_area_context_real_reset (GtkCellAreaContext *context)
{
GtkCellAreaContextPrivate *priv = context->priv;
- priv->min_width = -1;
- priv->nat_width = -1;
+ priv->min_width = -1;
+ priv->nat_width = -1;
+ priv->min_height = -1;
+ priv->nat_height = -1;
+ priv->alloc_width = 0;
+ priv->alloc_height = 0;
g_object_freeze_notify (G_OBJECT (context));
g_object_notify (G_OBJECT (context), "minimum-width");
g_object_notify (G_OBJECT (context), "natural-width");
- g_object_thaw_notify (G_OBJECT (context));
-}
-
-static void
-gtk_cell_area_context_real_flush_preferred_height (GtkCellAreaContext *context)
-{
- GtkCellAreaContextPrivate *priv = context->priv;
-
- priv->min_height = -1;
- priv->nat_height = -1;
-
- g_object_freeze_notify (G_OBJECT (context));
g_object_notify (G_OBJECT (context), "minimum-height");
g_object_notify (G_OBJECT (context), "natural-height");
g_object_thaw_notify (G_OBJECT (context));
}
-static void
-gtk_cell_area_context_real_flush_allocation (GtkCellAreaContext *context)
-{
- GtkCellAreaContextPrivate *priv = context->priv;
-
- priv->alloc_width = 0;
- priv->alloc_height = 0;
-}
-
static void
gtk_cell_area_context_real_allocate (GtkCellAreaContext *context,
gint width,
}
void
-gtk_cell_area_context_flush (GtkCellAreaContext *context)
-{
- g_return_if_fail (GTK_IS_CELL_AREA_CONTEXT (context));
-
- gtk_cell_area_context_flush_preferred_width (context);
- gtk_cell_area_context_flush_preferred_height (context);
- gtk_cell_area_context_flush_allocation (context);
-}
-
-void
-gtk_cell_area_context_flush_preferred_width (GtkCellAreaContext *context)
-{
- g_return_if_fail (GTK_IS_CELL_AREA_CONTEXT (context));
-
- GTK_CELL_AREA_CONTEXT_GET_CLASS (context)->flush_preferred_width (context);
-}
-
-void
-gtk_cell_area_context_flush_preferred_height (GtkCellAreaContext *context)
-{
- g_return_if_fail (GTK_IS_CELL_AREA_CONTEXT (context));
-
- GTK_CELL_AREA_CONTEXT_GET_CLASS (context)->flush_preferred_height (context);
-}
-
-void
-gtk_cell_area_context_flush_allocation (GtkCellAreaContext *context)
+gtk_cell_area_context_reset (GtkCellAreaContext *context)
{
g_return_if_fail (GTK_IS_CELL_AREA_CONTEXT (context));
- GTK_CELL_AREA_CONTEXT_GET_CLASS (context)->flush_allocation (context);
+ GTK_CELL_AREA_CONTEXT_GET_CLASS (context)->reset (context);
}
void
{
GObjectClass parent_class;
- /* Subclasses can use this to flush their alignments/allocations */
- void (* flush_preferred_width) (GtkCellAreaContext *context);
- void (* flush_preferred_height) (GtkCellAreaContext *context);
- void (* flush_allocation) (GtkCellAreaContext *context);
-
- /* These must be invoked after a series of requests before consulting
- * the context values, implementors use this to push the overall
- * requests while acconting for any internal alignments */
- void (* sum_preferred_width) (GtkCellAreaContext *context);
- void (* sum_preferred_height) (GtkCellAreaContext *context);
-
- /* Store an allocation value for a GtkCellArea contextual to a range of
- * treemodel rows */
- void (* allocate) (GtkCellAreaContext *context,
- gint width,
- gint height);
+ void (* sum_preferred_width) (GtkCellAreaContext *context);
+ void (* sum_preferred_height) (GtkCellAreaContext *context);
+ void (* allocate) (GtkCellAreaContext *context,
+ gint width,
+ gint height);
+ void (* reset) (GtkCellAreaContext *context);
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved4) (void);
};
-GType gtk_cell_area_context_get_type (void) G_GNUC_CONST;
-
-GtkCellArea *gtk_cell_area_context_get_area (GtkCellAreaContext *context);
-
-/* Apis for GtkCellArea clients to flush the cache */
-void gtk_cell_area_context_flush (GtkCellAreaContext *context);
-void gtk_cell_area_context_flush_preferred_width (GtkCellAreaContext *context);
-void gtk_cell_area_context_flush_preferred_height (GtkCellAreaContext *context);
-void gtk_cell_area_context_flush_allocation (GtkCellAreaContext *context);
-
-/* Apis for GtkCellArea clients to sum up the results of a series of requests, this
- * call is required to reduce the processing while calculating the size of each row */
-void gtk_cell_area_context_sum_preferred_width (GtkCellAreaContext *context);
-void gtk_cell_area_context_sum_preferred_height (GtkCellAreaContext *context);
-
-/* Apis to set an allocation size in one dimension or another, the subclass specific context
- * will store allocated positions/sizes for individual cells or groups of cells */
-void gtk_cell_area_context_allocate (GtkCellAreaContext *context,
- gint width,
- gint height);
-
-/* Apis for GtkCellArea clients to consult cached values for multiple GtkTreeModel rows */
-void gtk_cell_area_context_get_preferred_width (GtkCellAreaContext *context,
- gint *minimum_width,
- gint *natural_width);
-void gtk_cell_area_context_get_preferred_height (GtkCellAreaContext *context,
- gint *minimum_height,
- gint *natural_height);
-void gtk_cell_area_context_get_allocation (GtkCellAreaContext *context,
- gint *width,
- gint *height);
+GType gtk_cell_area_context_get_type (void) G_GNUC_CONST;
+
+/* Main apis */
+GtkCellArea *gtk_cell_area_context_get_area (GtkCellAreaContext *context);
+void gtk_cell_area_context_sum_preferred_width (GtkCellAreaContext *context);
+void gtk_cell_area_context_sum_preferred_height (GtkCellAreaContext *context);
+void gtk_cell_area_context_allocate (GtkCellAreaContext *context,
+ gint width,
+ gint height);
+void gtk_cell_area_context_reset (GtkCellAreaContext *context);
+
+/* Apis for GtkCellArea clients to consult cached values for a series of GtkTreeModel rows */
+void gtk_cell_area_context_get_preferred_width (GtkCellAreaContext *context,
+ gint *minimum_width,
+ gint *natural_width);
+void gtk_cell_area_context_get_preferred_height (GtkCellAreaContext *context,
+ gint *minimum_height,
+ gint *natural_height);
+void gtk_cell_area_context_get_allocation (GtkCellAreaContext *context,
+ gint *width,
+ gint *height);
/* Apis for GtkCellArea implementations to update cached values for multiple GtkTreeModel rows */
-void gtk_cell_area_context_push_preferred_width (GtkCellAreaContext *context,
- gint minimum_width,
- gint natural_width);
-void gtk_cell_area_context_push_preferred_height (GtkCellAreaContext *context,
- gint minimum_height,
- gint natural_height);
+void gtk_cell_area_context_push_preferred_width (GtkCellAreaContext *context,
+ gint minimum_width,
+ gint natural_width);
+void gtk_cell_area_context_push_preferred_height (GtkCellAreaContext *context,
+ gint minimum_height,
+ gint natural_height);
G_END_DECLS
}
static void
-rebuild_and_flush_internals (CellAreaScaffold *scaffold)
+rebuild_and_reset_internals (CellAreaScaffold *scaffold)
{
CellAreaScaffoldPrivate *priv = scaffold->priv;
gint n_rows;
else
g_array_set_size (priv->row_data, 0);
- /* Data changed, lets flush the context and consequently queue resize and
+ /* Data changed, lets reset the context and consequently queue resize and
* start everything over again (note this is definitly far from optimized) */
- gtk_cell_area_context_flush (priv->context);
+ gtk_cell_area_context_reset (priv->context);
}
static void
GtkTreeIter *iter,
CellAreaScaffold *scaffold)
{
- rebuild_and_flush_internals (scaffold);
+ rebuild_and_reset_internals (scaffold);
}
static void
GtkTreeIter *iter,
CellAreaScaffold *scaffold)
{
- rebuild_and_flush_internals (scaffold);
+ rebuild_and_reset_internals (scaffold);
}
static void
GtkTreePath *path,
CellAreaScaffold *scaffold)
{
- rebuild_and_flush_internals (scaffold);
+ rebuild_and_reset_internals (scaffold);
}
static void
gint *new_order,
CellAreaScaffold *scaffold)
{
- rebuild_and_flush_internals (scaffold);
+ rebuild_and_reset_internals (scaffold);
}
/*********************************************************
G_CALLBACK (rows_reordered_cb), scaffold);
}
- rebuild_and_flush_internals (scaffold);
+ rebuild_and_reset_internals (scaffold);
}
}